import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'app-menu',
  templateUrl: './menu.component.html',
  styleUrls: ['./menu.component.css']
})
export class MenuComponent implements OnInit {
 
  munus:Array<Menu>;
  currentMenuId:number = 1;
  constructor(public router:Router) { }

  ngOnInit() {
    this.munus = [
      new Menu(1,"首页","dashboard"),
      new Menu(2,"股票管理","stock")
    ]
  }
  nav(munu:Menu){
    this.router.navigateByUrl(munu.link);
    this.currentMenuId = munu.id;
  }
}

export class Menu {
  constructor(
    public id:number,
    public name:string,
    public link:string
  ){}
}

